package com.api.department.editdepartment;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IDepartmentApiService;
import com.zyncro.api.exceptions.ZyncroApiException;

@ContextConfiguration(locations = "classpath:/department/department-toedit.xml")
public class EditDepartmentNotOwner extends AbstractApiTest {

	@Value("#{department_toEdit[notOwner].appId}")
	private String userUrn;

	@Value("#{department_toEdit[notOwner].password}")
	private String userPassword;

	@Value("#{department_toEdit.urn}")
	private String iddepartment;

	@BeforeClass
	protected void loginUser() throws Exception {

		getApi().login(userUrn, userPassword);
	}

	@Test(expectedExceptions = ZyncroApiException.class)
	public void test() throws ZyncroApiException {
		String name = "New name";
		String description = "New descript";
		String logo = null;
		String address = null;
		String telephone = null;
		String email = null;
		String web = null;
		String idnewmanager = null;
		String attributes = null;
		Boolean defaultvote = null;

		getApi().getService(IDepartmentApiService.class).editDepartment(iddepartment, name, description, logo, address, telephone, email,
				web, idnewmanager, attributes, defaultvote);
	}
}
